<template>
  <!-- 对话框(添加 / 修改) -->
  <el-dialog
    :title="title"
    :visible.sync="showView"
    width="500px"
    append-to-body
    :before-close="cancel"
    :close-on-click-modal="false"
  >
    <el-form
      disabled
      ref="form"
      :model="form"
      :rules="rules"
      label-width="80px"
    >
      <el-form-item label="学生姓名" prop="studentName">
        <el-input v-model="form.studentName" />
      </el-form-item>
      <el-form-item label="联系方式" prop="phone">
        <el-input v-model="form.phone" />
      </el-form-item>
      <el-form-item label="老师姓名" prop="teacherName">
        <el-input v-model="form.teacherName" />
      </el-form-item>
      <el-form-item label="评价描述" prop="evaluationText">
        <el-input v-model="form.evaluationText" />
      </el-form-item>
      <el-form-item label="所属学院" prop="collegeName">
        <el-input v-model="form.collegeName" />
      </el-form-item>
      <!--   预留字段，后续需要显示放开即可   -->
      <!--
                      <el-form-item label="所属系部" prop="departmentName">
                        <el-input v-model="form.departmentName" />
                      </el-form-item>
                      <el-form-item label="所属专业" prop="professionsName">
                        <el-input v-model="form.professionsName"/>
                      </el-form-item>
        -->
      <el-form-item label="所属班级" prop="classeName">
        <el-input v-model="form.classeName" />
      </el-form-item>
      <el-form-item label="评价项目" prop="evaluationItemName">
        <el-input v-model="form.evaluationItemName" />
      </el-form-item>
      <el-form-item label="评分等级" prop="scoreItemName">
        <el-input v-model="form.scoreItemName" />
      </el-form-item>
    </el-form>
  </el-dialog>
</template>

<script>
import { createTeacherEvaluation, updateTeacherEvaluation } from "@/api/study/teacherEvaluation";

export default {
  name: "TeacherEvaluationView",
  components: {
  },
  data() {
    return {
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        studentId: [{ required: true, message: "学生id不能为空", trigger: "blur" }],
        teacherId: [{ required: true, message: "老师id不能为空", trigger: "blur" }],
        collegeId: [{ required: true, message: "所属学院id不能为空", trigger: "blur" }],
        departmentId: [{ required: true, message: "所属系部id不能为空", trigger: "blur" }],
        professionsId: [{ required: true, message: "所属专业id不能为空", trigger: "blur" }],
        classeId: [{ required: true, message: "所属班级id不能为空", trigger: "blur" }],
        evaluationItemId: [{ required: true, message: "评价项目id不能为空", trigger: "blur" }],
        scoreItemId: [{ required: true, message: "评分等级id不能为空", trigger: "blur" }],
      }
    };
  },
  created() { },
  props: {
    // 是否显示弹出层
    showView: {
      type: Boolean,
      default: false
    },
    // 显示弹出层标题
    title: {
      type: String,
      default: ''
    }
  },
  methods: {
    /** 初始化编辑的数据**/
    initData(rowData) {
      this.reset();
      if (rowData && rowData.id) {
        this.form = rowData;
        this.form.datetimerange = [this.form.startTime, this.form.endTime]
      }
    },
    /** 取消按钮 */
    cancel() {
      this.$emit('update:showView', false)
      this.reset();
    },
    /** 表单重置 */
    reset() {
      this.form = {
        id: undefined,
        studentId: undefined,
        studentName: undefined,
        teacherId: undefined,
        teacherName: undefined,
        evaluationText: undefined,
        collegeName: undefined,
        collegeId: undefined,
        departmentName: undefined,
        departmentId: undefined,
        professionsName: undefined,
        professionsId: undefined,
        classeName: undefined,
        classeId: undefined,
        evaluationItemId: undefined,
        evaluationItemName: undefined,
        scoreItemId: undefined,
        scoreItemName: undefined,
        remark: undefined,
        orgId: undefined,
      };
      this.resetForm("form");
    },

  }
};
</script>
